CMAKE_MINIMUM_REQUIRED(VERSION 3.0)

IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
# Use standard target names
CMAKE_POLICY(SET CMP0078 NEW)
ENDIF()
IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.14)
# Allows SWIG_MODULE_NAME to be set
CMAKE_POLICY(SET CMP0086 NEW)
ENDIF()

SET (CMAKE_CXX_STANDARD 20)

################################################################

FIND_PACKAGE(SWIG 3.0 REQUIRED)
INCLUDE(UseSWIG)

SET(STA_SWIG_FILE ${HOME_OPERATION}/iSTA/cmd/sta.i)

SET_PROPERTY(SOURCE ${STA_SWIG_FILE}
  PROPERTY CPLUSPLUS ON
)

SET_PROPERTY(SOURCE ${STA_SWIG_FILE}
  PROPERTY SWIG_FLAGS
  -module ista
  -namespace -prefix ista
)

MESSAGE(STATUS "USE SWIG ${STA_SWIG_FILE} ${PROJECT_SOURCE_DIR}/build/swig")

swig_add_library(cmd
  LANGUAGE tcl
  TYPE STATIC
  OUTPUT_DIR ${PROJECT_SOURCE_DIR}/build/swig
  SOURCES ${STA_SWIG_FILE}
)

set_target_properties(cmd PROPERTIES
  POSITION_INDEPENDENT_CODE ON)

TARGET_LINK_LIBRARIES(cmd
  PUBLIC
  sdc  
  tcl8.6
)


